import request from '@/utils/request'
var group_name = 'blog'
export default {
  save(blog) { // 添加
    return request({
      url: `/${group_name}/save`,
      method: 'post',
      data: blog
    })
  },
  getByPage(page) { // 分页查询
    return request({
      url: `/${group_name}/getByPage`,
      method: 'post',
      data: page
    })
  },
  blogGoods(blogGoods) { // 博客点赞
    return request({
      url: `/${group_name}/blogGoods`,
      method: 'put',
      data: blogGoods
    })
  },
  getBlogGoods(blogId) { // 获取是否点赞
    return request({
      url: `/${group_name}/getIsBlogGoods/${blogId}`,
      method: 'get'
    })
  },
  blogCollect(blogId) { // 博客收藏
    return request({
      url: `/${group_name}/collect/${blogId}`,
      method: 'post'
    })
  },
  cancelBlogCollect(blogId) { // 博客收藏
    return request({
      url: `/${group_name}/cancelCollect/${blogId}`,
      method: 'delete'
    })
  },
  getCollect(blogId) { // 获取收藏信息
    return request({
      url: `/${group_name}/getCollect/${blogId}`,
      method: 'get'
    })
  },
  cancelBlogGoods(blogId) { // 获取是否点赞
    return request({
      url: `/${group_name}/cancelBlogGoods/${blogId}`,
      method: 'delete'
    })
  },
  getSum() { // 分页查询
    return request({
      url: `/${group_name}/getBlogTotalCount`,
      method: 'get'
    })
  },
  update(blog) { // 更新
    return request({
      url: `/${group_name}/update`,
      method: 'put',
      data: blog
    })
  },
  deleteById(id) { // 删除
    return request({
      url: `/${group_name}/delete/${id}`,
      method: 'delete'
    })
  },
  deleteByIds(ids) { // 删除
    return request({
      url: `/${group_name}/deleteByIds`,
      method: 'delete',
      data: ids
    })
  },
  read(id) { // 根据id查询
    return request({
      url: `/${group_name}/read/${id}`,
      method: 'get'
    })
  },
  recomRead(id) { // 根据id查询
    return request({
      url: `/${group_name}/recomRead`,
      method: 'get'
    })
  },
  getTimeLine() { // 根据id查询
    return request({
      url: `/${group_name}/getTimeLine`,
      method: 'get'
    })
  }
}
